<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="common/include :: header('添加养修信息预约')" />
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-appointment-add">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">拜访客户：</label>
                <div class="col-sm-8">
                    <select class="form-control" name="customerId" id="customer">
                        <option th:each="c: ${customer}" th:text="${c.customerName}" th:value="${c.id}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">客户联系人：</label>
                <div class="col-sm-8">
                    <select class="form-control" name="linkmanId" id="customerLinkMane">

                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">拜访方式：</label>
                <div class="col-sm-8">
                    <select class="form-control" name="visitType" th:with="type=${@dict.getType('ep_visit_type')}">
                        <option th:each="dict : ${type}" th:text="${dict.label}" th:value="${dict.value}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">拜访时间：</label>
                <div class="col-sm-8">
                    <input class="form-control DateTime" type="text" name="visitDate" id="actualArrivalTime" required>
                </div>
            </div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">拜访原因：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="visitReason" id="licensePlate" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">交流情况：</label>
				<div class="col-sm-8">
					<textarea id="info" name="content" class="form-control"></textarea>
				</div>
			</div>
		</form>
	</div>
	<th:block th:include="common/include :: footer" />
    <link rel="stylesheet" type="text/css" href="/plugins/datetimepicker/jquery.datetimepicker.min.css"/>
    <script src="/plugins/datetimepicker/jquery.datetimepicker.full.js"></script>

	<script type="text/javascript">
        var prefix = ctx + "/business/customerVisit";

        $("#customer").change(function () {
            $("#customerLinkMane").children().remove();
            var val = $("#customer").val();
            $.post("/business/customerVisit/customerBylinkman?id="+val,function (data) {
                $.each(data.data,function (index,item) {
                    $("#customerLinkMane").append("<option value="+item.customerLinkMane.id+">"+item.customerLinkMane.linkman+"</option>")
                });
            });
        });

		var prefix = ctx + "/business/customerVisit";

		function submitHandler() {
	        if ($.validate.form()) {
	        	$.operate.save(prefix + "/add", $('#form-appointment-add').serialize());
	        }
	    }

		$('.DateTime').datetimepicker({
			format:'Y-m-d H:i'
		});
		$.datetimepicker.setLocale('zh');
	</script>
</body>
</html>
